package com.example.javabasic.sample.bootstrap;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

/**
 * 与CommandLineRunner不同的地方在于，run方法接收封装好的ApplicationArguments参数
 *
 * @Author chenpenghui
 * @Date 2020/4/19
 */
@Component
public class ApplicationRunnerTest implements ApplicationRunner {

    private static Logger log = LoggerFactory.getLogger(ApplicationRunnerTest.class);

    @Override
    public void run(ApplicationArguments args) throws Exception {
        log.info(">>>ApplicationRunnerTest#run process...");
        log.info("获取参数：" + args.getOptionValues("param"));
    }
}
